 package server.maps;

 import client.MapleCharacter;
 import client.MapleClient;
 import client.skills.Skill;
 import client.skills.SkillFactory;
 import java.awt.Point;
 import java.awt.Rectangle;
 import java.util.concurrent.ScheduledFuture;
 import server.MapleStatEffect;
 import server.life.MapleMonster;
 import server.life.MobSkill;
 import tools.MaplePacketCreator;






 public class MapleMist
   extends MapleMapObject
 {
   private int skillID;
   private final Rectangle mistPosition;
   private final boolean isMobMist;
   private int skilllevel;
   private final int ownerId;
   private MapleStatEffect source;
   private MobSkill skill;
   private boolean isPoisonMist;
   private boolean isRecoverMist;
   private boolean isFacingLeft;
   private int skillDelay;
   private int mistType;
/*  35 */   private ScheduledFuture<?> schedule = null; private ScheduledFuture<?> poisonSchedule = null; private ScheduledFuture<?> handleSchedule = null; private ScheduledFuture<?> removeSchedule = null; private boolean isHolyFountain;
   private int healCount;
   private boolean isBurnAreas;
   private Point ownerPosition;
   private int subtype;
   private int force;
   private int forcex;
   private boolean isNotRemove;
   private int duration;
   private long startTime;
   private boolean repeat;

   public MapleMist(Rectangle mistPosition, MapleMonster mob, MobSkill skill, Point position) {
/*  48 */     this.mistPosition = mistPosition;
/*  49 */     this.ownerId = mob.getObjectId();
/*  50 */     this.skill = skill;
/*  51 */     this.skillID = skill.getSkillId();
/*  52 */     this.skilllevel = skill.getSkillLevel();
/*  53 */     this.isMobMist = true;
/*  54 */     this.isPoisonMist = true;
/*  55 */     this.isRecoverMist = false;
/*  56 */     this.repeat = true;
/*  57 */     this.mistType = 0;
/*  58 */     this.skillDelay = 0;
/*  59 */     this.force = skill.getForce();
/*  60 */     this.forcex = skill.getForcex();
/*  61 */     this.isNotRemove = false;
/*  62 */     this.duration = (int)skill.getDuration();
/*  63 */     this.startTime = System.currentTimeMillis();
/*  64 */     setPosition(position);
   }




   public MapleMist(Rectangle mistPosition, MapleCharacter owner, MapleStatEffect source, Point point) {
/*  71 */     this.mistPosition = mistPosition;

/*  73 */     this.ownerPosition = (source.getSourceid() == 400021031) ? point : owner.getPosition();
/*  74 */     this.ownerId = owner.getId();
/*  75 */     this.source = source;
/*  76 */     this.skillID = source.getSourceid();
/*  77 */     this.skillDelay = 10;
/*  78 */     this.isMobMist = false;
/*  79 */     this.isPoisonMist = false;
/*  80 */     this.isRecoverMist = false;
/*  81 */     this.repeat = true;
/*  82 */     this.healCount = 0;
/*  83 */     this.isHolyFountain = false;

/*  85 */     this.skilllevel = owner.getTotalSkillLevel(source.getSourceid());
/*  86 */     this.isFacingLeft = owner.isFacingLeft();
/*  87 */     this.isNotRemove = false;
/*  88 */     this.duration = source.getDuration(owner);
/*  89 */     this.startTime = System.currentTimeMillis();
/*  90 */     setPosition(point);
/*  91 */     switch (source.getSourceid()) {
       case 2201009:
/*  93 */         this.mistType = 0;
/*  94 */         this.skillDelay = 3;
/*  95 */         this.repeat = false;
         return;
       case 2311011:
/*  98 */         this.healCount = source.getY();
/*  99 */         this.isHolyFountain = true;
         return;
       case 32121006:
/* 102 */         this.mistType = 3;
         return;
       case 1076:
       case 2111003:
/* 106 */         this.isPoisonMist = true;
         return;
       case 12121005:
/* 109 */         this.isBurnAreas = true;
/* 110 */         this.skillDelay = 2;
         return;
       case 112001006:
/* 113 */         this.isPoisonMist = true;
/* 114 */         this.mistPosition.y += 50;
         return;
       case 112121005:
/* 117 */         this.skillDelay = 2;
/* 118 */         this.isRecoverMist = true;
         return;
       case 21121068:
/* 121 */         this.skillDelay = 2;
/* 122 */         this.isRecoverMist = true;
         return;
       case 155121006:
/* 125 */         this.skillDelay = 3;
         return;
       case 400021030:
       case 400021031:
       case 400021040:
/* 130 */         this.skilllevel = 1;
/* 131 */         this.skillDelay = 0;
/* 132 */         source.setDuration(800);
/* 133 */         this.source.setSourceid(400021031);
         return;


       case 400041041:
/* 138 */         this.skillDelay = 2;
         return;
     }
/* 141 */     this.mistType = 0;
   }


   public MapleMist(Rectangle mistPosition, MapleCharacter owner) {
/* 146 */     this.mistPosition = mistPosition;
/* 147 */     this.ownerId = owner.getId();
/* 148 */     this.source = new MapleStatEffect();
/* 149 */     this.source.setSourceid(2111003);
/* 150 */     this.skilllevel = 30;
/* 151 */     this.mistType = 0;
/* 152 */     this.isMobMist = false;
/* 153 */     this.isPoisonMist = false;
/* 154 */     this.skillDelay = 10;
   }


   public MapleMapObjectType getType() {
/* 159 */     return MapleMapObjectType.MIST;
   }


   public Point getPosition() {
/* 164 */     return this.mistPosition.getLocation();
   }


   public void setPosition(Point position) {}


   public Skill getSourceSkill() {
/* 172 */     return SkillFactory.getSkill(this.source.getSourceid());
   }

   public ScheduledFuture<?> getSchedule() {
/* 176 */     return this.schedule;
   }

   public void setSchedule(ScheduledFuture<?> s) {
/* 180 */     this.schedule = s;
   }

   public ScheduledFuture<?> getPoisonSchedule() {
/* 184 */     return this.poisonSchedule;
   }

   public void setPoisonSchedule(ScheduledFuture<?> s) {
/* 188 */     this.poisonSchedule = s;
   }


   public int getBuffLength() {
/* 193 */     if (this.skillID == 400021031) {
/* 194 */       return (int)-(this.startTime + this.duration - System.currentTimeMillis());
     }
/* 196 */     return (int)(this.startTime + this.duration - System.currentTimeMillis());
   }

   public void cancel() {
/* 200 */     if (this.handleSchedule != null) {
/* 201 */       this.handleSchedule.cancel(true);
/* 202 */       this.handleSchedule = null;
     }
/* 204 */     if (this.removeSchedule != null) {
/* 205 */       this.removeSchedule.cancel(true);
/* 206 */       this.removeSchedule = null;
     }
   }

   public ScheduledFuture<?> getHandleSchedule() {
/* 211 */     return this.handleSchedule;
   }

   public void setHandleSchedule(ScheduledFuture<?> handleSchedule) {
/* 215 */     this.handleSchedule = handleSchedule;
   }




   public boolean isMobMist() {
/* 222 */     return this.isMobMist;
   }




   public boolean isPoisonMist() {
/* 229 */     return this.isPoisonMist;
   }




   public boolean isRecoverMist() {
/* 236 */     return this.isRecoverMist;
   }




   public boolean isHolyFountain() {
/* 243 */     return this.isHolyFountain;
   }




   public boolean isBurnAreas() {
/* 250 */     return this.isBurnAreas;
   }

   public int getHealCount() {
/* 254 */     return isHolyFountain() ? this.healCount : 0;
   }

   public void setHealCount(int count) {
/* 258 */     this.healCount = count;
   }

   public int getMistType() {
/* 262 */     return this.mistType;
   }

   public void setMistType(int mistType) {
/* 266 */     this.mistType = mistType;
   }

   public int getSkillDelay() {
/* 270 */     return this.skillDelay;
   }

   public void setSkillDelay(int skillDelay) {
/* 274 */     this.skillDelay = skillDelay;
   }

   public int getSkillLevel() {
/* 278 */     return this.skilllevel;
   }

   public int getOwnerId() {
/* 282 */     return this.ownerId;
   }

   public MobSkill getMobSkill() {
/* 286 */     return this.skill;
   }

   public Rectangle getBox() {
/* 290 */     return this.mistPosition;
   }

   public MapleStatEffect getSource() {
/* 294 */     return this.source;
   }

   public byte[] fakeSpawnData(int level) {
/* 298 */     return MaplePacketCreator.spawnMist(this);
   }

   public Point getOwnerPosition() {
/* 302 */     return this.ownerPosition;
   }

   public boolean isFacingLeft() {
/* 306 */     return this.isFacingLeft;
   }

   public int getSubtype() {
/* 310 */     return this.subtype;
   }

   public void setSubtype(int subtype) {
/* 314 */     this.subtype = subtype;
   }

   public int getForce() {
/* 318 */     return this.force;
   }

   public int getForcex() {
/* 322 */     return this.forcex;
   }

   public boolean isNotRemove() {
/* 326 */     return this.isNotRemove;
   }

   public int getDuration() {
/* 330 */     return this.duration;
   }

   public boolean isRepeat() {
/* 334 */     return this.repeat;
   }

   public int getSkillID() {
/* 338 */     return this.skillID;
   }


   public void sendSpawnData(MapleClient c) {
/* 343 */     c.announce(MaplePacketCreator.spawnMist(this));
   }


   public void sendDestroyData(MapleClient c) {
/* 348 */     c.announce(MaplePacketCreator.removeMist(getObjectId(), false));
   }

   public boolean makeChanceResult() {
/* 352 */     return this.source.makeChanceResult();
   }

   public void setRemoveSchedule(ScheduledFuture<?> removeSchedule) {
/* 356 */     this.removeSchedule = removeSchedule;
   }
 }


/* Location:              C:\PGX\Server.jar!\server\maps\MapleMist.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */